<template>
  <div class="app-container">
    <el-table v-loading="listLoading" :data="list" style="width: 100%">
      <el-table-column prop="t_id" label="教师id" width="180" />
      <el-table-column prop="name" label="姓名" width="180" />
      <el-table-column prop="totalcompleted" label="已完成人数" width="180" />
      <el-table-column prop="total" label="任务总人数" width="180" />
    </el-table>
  </div>
</template>

<script>
import * as task from '@/api/task'

export default {
  data() {
    return {
      list: null,
      listLoading: true
    }
  },
  created() {
    if (this.$route.query.row) {
      console.log(this.$route.query.row)
      this.ruleForm = this.$route.query.row
      this.task_id = this.ruleForm.id
      if (this.task_id) this.fetchData(this.task_id)
      else this.$router.push('/task/index')
    } else this.$router.push('/task/index')
  },
  methods: {
    fetchData(id) {
      this.listLoading = true
      task.progress({ task_id: id }).then((response) => {
        this.list = response.data
        this.listLoading = false
        console.log(this.list)
      })
    }
  }
}
</script>
